﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace dotnet_ef_admin.Migrations
{
    /// <inheritdoc />
    public partial class dictTypeAndDictOneToMany : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<int>(
                name: "DictTypeId",
                table: "dict",
                type: "INTEGER",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.CreateIndex(
                name: "IX_dict_DictTypeId",
                table: "dict",
                column: "DictTypeId");

            migrationBuilder.AddForeignKey(
                name: "FK_dict_dict_type_DictTypeId",
                table: "dict",
                column: "DictTypeId",
                principalTable: "dict_type",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_dict_dict_type_DictTypeId",
                table: "dict");

            migrationBuilder.DropIndex(
                name: "IX_dict_DictTypeId",
                table: "dict");

            migrationBuilder.DropColumn(
                name: "DictTypeId",
                table: "dict");
        }
    }
}
